{% extends "student/base.html" %}
{% block content %}
    <div class="layui-container">
        <blockquote class="layui-elem-quote">
            <h1>CRUD——Django + LayUI</h1>
        </blockquote>
        {# 查询学生模块 #}
        <form action="/search" method="get">
            <input placeholder="学生名" name="q" id="q">
            <input type="submit" class="layui-btn" value="搜索">
        </form>

        {# 显示所有学生模块 #}
        <table class="layui-table">
      <colgroup>
        <col width="150">
        <col width="200">
        <col>
      </colgroup>
      <thead>
        <tr>
            <th>id</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>图片</th>
            <th>修改</th>
            <th>删除</th>
        </tr>
      </thead>
      <tbody>
        {%for student in data%}
            <tr>
                <td>{{student.id}}</td>
                <td>{{student.t_name}}</td>
                <td>{{student.t_age}}</td>
                <td>
                    <img src="{{ student.t_image }}" height="50px">
                </td>
                <td>
                    {# 修改学生模块 #}
                    <a href="/get/{{ student.id }}" class="layui-btn layui-btn-normal">
                        <i class="layui-icon">&#xe642;</i>修改
                    </a>
                </td>
                <td>
                    {# 删除学生模块 #}
                    <a href="/delete/{{ student.id }}" class="layui-btn layui-btn-danger">
                        <i class="layui-icon">&#xe640;</i>删除
                    </a>
                </td>
            </tr>
        {%endfor%}
      </tbody>
        </table>

        {# 添加学生模块 #}
        <a href="/addPage" class="layui-btn layui-btn-warm">
            <i class="layui-icon">&#xe654;</i> 添加
        </a>
    </div>
{% endblock %}